/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.inventory.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author sithum
 */
@Entity
@Table(name = "MARKET_RETURN", catalog = "", schema = "APP")
@NamedQueries({@NamedQuery(name = "MarketReturn.findAll", query = "SELECT m FROM MarketReturn m"), @NamedQuery(name = "MarketReturn.findByMarketReturnId", query = "SELECT m FROM MarketReturn m WHERE m.marketReturnId = :marketReturnId"), @NamedQuery(name = "MarketReturn.findByQuantity", query = "SELECT m FROM MarketReturn m WHERE m.quantity = :quantity"), @NamedQuery(name = "MarketReturn.findByPriceRate", query = "SELECT m FROM MarketReturn m WHERE m.priceRate = :priceRate"), @NamedQuery(name = "MarketReturn.findByReturnDate", query = "SELECT m FROM MarketReturn m WHERE m.returnDate = :returnDate")})
public class MarketReturn implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "MARKET_RETURN_ID", nullable = false)
    private Integer marketReturnId;
    @Column(name = "QUANTITY")
    private Integer quantity;
    @Column(name = "PRICE_RATE", precision = 8, scale = 2)
    private BigDecimal priceRate;
    @Column(name = "RETURN_DATE")
    @Temporal(TemporalType.DATE)
    private Date returnDate;
    @JoinColumn(name = "INVOICE_ID", referencedColumnName = "INVOICE_ID")
    @ManyToOne
    private Invoice invoiceId;
    @JoinColumn(name = "ITEM_ID", referencedColumnName = "ITEM_ID")
    @ManyToOne
    private Item itemId;

    public MarketReturn() {
    }

    public MarketReturn(Integer marketReturnId) {
        this.marketReturnId = marketReturnId;
    }

    public Integer getMarketReturnId() {
        return marketReturnId;
    }

    public void setMarketReturnId(Integer marketReturnId) {
        this.marketReturnId = marketReturnId;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getPriceRate() {
        return priceRate;
    }

    public void setPriceRate(BigDecimal priceRate) {
        this.priceRate = priceRate;
    }

    public Date getReturnDate() {
        return returnDate;
    }

    public void setReturnDate(Date returnDate) {
        this.returnDate = returnDate;
    }

    public Invoice getInvoiceId() {
        return invoiceId;
    }

    public void setInvoiceId(Invoice invoiceId) {
        this.invoiceId = invoiceId;
    }

    public Item getItemId() {
        return itemId;
    }

    public void setItemId(Item itemId) {
        this.itemId = itemId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (marketReturnId != null ? marketReturnId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MarketReturn)) {
            return false;
        }
        MarketReturn other = (MarketReturn) object;
        if ((this.marketReturnId == null && other.marketReturnId != null) || (this.marketReturnId != null && !this.marketReturnId.equals(other.marketReturnId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.inventory.entities.MarketReturn[marketReturnId=" + marketReturnId + "]";
    }

}
